const oneDay = 3600* 1000*24
const p=3;
const q = 11;
const n =q*p;
// const T = (q-1)*(p-1);
const e= 3;
const d=7

const quickMuilty = (num,bbb) => {
	let basenum=1
	while(bbb>1){
		if(bbb&1){
			basenum*=num;
		}
		bbb=bbb>>1
		num=(num**2)%n;
	}
	basenum%=n
	return (num*basenum)%n;
}
export const Pfun = (num) => {
	const Arr = []
	let str = num.toString()
	for(let i=0;i<str.length;i+=2){
		let a 
		if(i!=str.length-1)a=str[i]+str[i+1]
		else a=str[i]
		a-=0
		a=quickMuilty(a,d)
		Arr.push(a)
	}
	str = Arr.join('a')+'&'+new Date(new Date().getTime()+7*oneDay).getTime()
	return str
}
export const Popenfun = (str) => {

	if(!str)return 0
	let arr = str.split('&')
	let numarr = arr[0].split('a')
	let mystr = ''
	for(let i=0;i<numarr.length;i++){
		let nownum = quickMuilty(numarr[i],e)
		
		if(nownum>10||i==numarr.length-1)mystr+=nownum;
		else mystr+='0'+nownum
	}

	let data = new Date(arr[1]-0)

	return data.getTime()>new Date().getTime()? mystr : 0
}

export const PackagePath = "BLOG01_HAS_TOKEN"